<!-- 会员充值计划表单弹窗 -->
<form id="recharge-form" lay-filter="recharge-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">'充值套餐'</label>
        <div class="layui-input-block">
            <input name="name" placeholder="请输入'充值套餐'" type="text" class="layui-input" maxlength="20"  id="name"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">原价</label>
        <div class="layui-input-block">
            <input name="originalPrice" placeholder="请输入原价" type="text" class="layui-input" maxlength="20"  id="originalPrice"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">优惠价</label>
        <div class="layui-input-block">
            <input name="discountPrice" placeholder="请输入优惠价" type="text" class="layui-input" maxlength="20"  id="discountPrice"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">充值赠送金额</label>
        <div class="layui-input-block">
            <input name="giveMoney" placeholder="请输入充值赠送金额" type="text" class="layui-input" maxlength="20"  id="giveMoney"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">套餐说明</label>
        <div class="layui-input-block">
            <input name="remark" placeholder="请输入套餐说明" type="text" class="layui-input" maxlength="20"  id="remark"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <input name="createTime" placeholder="请输入创建时间" type="text" class="layui-input" maxlength="20"  id="createTime"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">0-使用中，1-禁用</label>
        <div class="layui-input-block">
            <input name="status" placeholder="请输入0-使用中，1-禁用" type="text" class="layui-input" maxlength="20"  id="status"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input name="img" placeholder="请输入" type="text" class="layui-input" maxlength="20"  id="img"
                   lay-verify="required" required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入" type="text" class="layui-input" maxlength="20"  id="businessId"
                   lay-verify="required" required/>
        </div>
    </div>
     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var recharge = admin.getTempData('t_recharge');
           if (recharge.method=="update"){
        	form.val('recharge-form', recharge);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('business/recharge/'+recharge.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
